package com.demo.advice;

import org.aopalliance.intercept.MethodInterceptor;
import org.aopalliance.intercept.MethodInvocation;
import org.springframework.stereotype.Component;

import javax.annotation.Nonnull;
import javax.annotation.Nullable;

/**
 * @author shenguangyang
 */
@Component
public class MyAroundAdvice implements MethodInterceptor {
    @Nullable
    @Override
    public Object invoke(@Nonnull MethodInvocation invocation) throws Throwable {
        System.out.println("MyAroundAdvice 前");
        // 执行被代理的方法
        Object proceed = invocation.proceed();
        System.out.println("MyAroundAdvice 后");
        return proceed;
    }
}
